package model

import "gorm.io/gorm"

// 黑名单
type Blacklist struct {
	gorm.Model
	UserId   int `gorm:"type:int" json:"userId"`
	FriendId int `gorm:"type:int" json:"friendId"`
}

// 添加黑名单
func (b *Blacklist) AddBlack(db *gorm.DB) error {
	return db.Debug().Create(&b).Error
}

func (b *Blacklist) ListBlack(db *gorm.DB, userId int) (list []*Blacklist, err error) {
	err = db.Debug().Where("user_id = ?", userId).Find(&list).Error
	return list, err
}
